﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Canteen.Core.Models
{
    //消费订单
    public class ShopOrder : BaseEntity
    {
        [MaxLength(32), Required]
        [Column(TypeName = "VARCHAR(20)")]
        public string OrderNo { get; set; }//订单号

        [ForeignKey("UserId")]
        public int UserId { get; set; }//User外键
        public virtual User User { get; set; }//User导航属性

        [ForeignKey("StoreId")]
        public int StoreId { get; set; }//Store外键
        public virtual Store Store { get; set; }//Store导航属性

        public int? Status { get; set; }//订单状态
        public int PayStatus { get; set; } = 0;//支付状态 0支付中 1支付成功 2支付失败
        [MaxLength(16)]
        public string PayMode { get; set; }//支付方式：余额扣款、校园一卡通、微信支付、支付宝付款

        [Column(TypeName = "DATETIME")]
        public DateTime? PayTime { get; set; }//支付时间
        [Column(TypeName = "DATETIME")]
        public DateTime? FinishTime { get; set; }//订单完成时间

        [Column(TypeName = "MONEY")]
        public decimal? Price { get; set; }//订单金额
        [Column(TypeName = "MONEY")]
        public decimal? Discount { get; set; }//折扣费用
        [Column(TypeName = "MONEY")]
        public decimal? TotalPrice { get; set; }//订单总价
       

        public bool IsDel { get; set; } = false;

        public List<ShopOrderProducts> ShopOrderProductList { get; set; } = new List<ShopOrderProducts>();
    }
}
